System and method for smoothing sampled digital signals

ABSTRACT

Waveforms are digitally sampled and compressed for storage in memory. The compression of the data includes generating a truncated entropy encoding map and using the values within the map to obtain good compression. An encoder further sub-selects values to be encoded and values to remain unencoded to provide an overall compression of the data.

BACKGROUND OF THE INVENTION

The present invention relates to data storage and processing and inparticular data storage and processing with data obtained from animplantable medical device.

DESCRIPTION OF THE RELATED ART

There are numerous implantable medical devices (IMDs) used to providevarious therapies or collect data that is useful in evaluating andproviding care for a patient. Common cardiac IMDs would includeimplantable pulse generators (IPGs) or pacemakers, implantable cardiacdefibrillators (ICDs) which often include pacing capabilities, devicessensing other cardiac parameters such as pressure or impedance,implantable loop recorders (ILRs) which collect data but do notnecessarily provide any therapy function, or any combination. Beyondcardiac devices, IMDs are commonly used in a wide variety of otherapplications. For example, neurological devices may stimulate or gatherinformation from the brain or portions of the nervous system. Devicesmay be provided to monitor glucose levels and dispense insulin. The useand applicability of IMDs is constantly expanding into additionalanatomical and physiological fields.

While the various IMDs may be quite different in form, function, andoperation there are certain characteristics that will apply generally.As the device is implanted within the patient (and generally not readilyaccessible), such a device should be reliable, self sustaining for anappropriate period of time, and when appropriate, have the ability tocommunicate with other implanted devices or devices external to thepatient. Certain desirable characteristics will tend to compete againstone another. For example, minimizing the size of a given device isgenerally preferred; however, this in turn limits the space availablefor internal components. Similarly, there is a preference to have asmany features or functions as possible; but these taxes the alreadylimited resources in terms of power consumption and internal components.

Information or data is in some form a physical construct that behavesand can be manipulated according to certain laws, regardless of theparticular storage medium or mechanism. In fact, information can bediscussed in terms of scientific principles such as thermodynamics,quantum mechanics and the like. In particular, the concept of entropyfrom the second law of thermodynamics is useful in describing quantitiesof non-redundant data in a set.

This is useful in that there is a continuing desire to develop andoperate IMDs efficiently and effectively, while maximizing the benefitand usefulness of scarce resources. One area often considered isinternal memory and information processing. As electronic devices ingeneral, and memory in particular, improve certain benefits are realizedin scale within IMDs. However, as more resources become available (e.g.,memory) the amount of information expected to be collected and storedincreases. Thus, there is a desire to efficiently collect, store andtransmit data with an appropriate degree of reliability.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is an illustration of an IMD consistent with the principles ofthe present invention.

FIG. 2 is a block diagram of a data compression module consistent withthe principles of the present invention.

FIGS. 3-7 are graphs of waveforms and corresponding probabilitydistributions.

FIG. 8 is a schematic diagram illustrating a truncated encoding tree.

FIG. 9 is a graph of a sampled waveform.

FIG. 10 is an expanded view of a portion of the waveform of FIG. 9.

FIG. 11 is a schematic diagram of sequentially stored data.

FIG. 12 is a flowchart of a process consistent with the teachings of thepresent invention.

FIG. 13 is a block diagram illustrating a decoding arrangementconsistent with the teachings of the present invention.

FIG. 14 is a schematic diagram illustrating a truncated encoding tree.

FIG. 15 is a sampled waveform.

FIG. 16 is a flowchart of a smoothing process consistent with theteachings of the present invention.

DETAILED DESCRIPTION

FIG. 1 is a block diagram illustrating some, but certainly not all ofthe components of a typical implantable medical device (IMD) 100. Theconstruction, operation, usage and implementation of various IMDs isgenerally known and FIG. 1 is provided simply for illustrative andnon-limiting purposes.

The IMD 100 includes an appropriate housing 102 enclosing the variouscomponents. One or more microprocessors 120 are typically provided alongwith a power supply 122 which usually includes a battery and capacitors(for high voltage therapy). One or more memory modules 124 are providedin various forms that may include operating instructions and/or receiveand store data collected by the IMD 100. The IMD 100 includes atransceiver 126 that permits two-way communication between the IMD 100and an external (to the patient) device and/or another implanted device.A therapy module 128 is illustrated and generally includes thecomponents and instructions to provide one or more therapies, if the IMD100 is so equipped. Examples may include pacing, defibrillation, neuralstimulation, drug delivery and so on. A signal processor 130 receivesand processes data. An analog to digital converter (ADC) 132 receives araw or processed analog signal and convert that signal into digitaldata. The IMD 100 may include on or more sense amplifiers 134 thatreceive data from one or more sensors 138, 140 and then output theamplified signal to other components within the IMD 100. A given sensor138 may be coupled directly with the housing 102 or a remote sensor 140may be coupled via a lead 142 or through wireless communication. Tomaximize resources, the IMD 100 includes a data compression module 136that compresses data before storing that data into memory 132. Alsoincluded is a smoothing/filter module 160.

When cardiac data, for example, is collected by the IMD 100, it isreferred to as an electrogram (EGM) as opposed to surface collected datain the form of an electrocardiogram (EKG or ECG). The EGM data is storedin the memory 124 until it is telemetered out, the IMD 100 is extracted,or the memory capacity is exceeded and the data is overwritten. The IMD100 includes a finite memory and has a limited power supply; thus, careis taken to minimize any unnecessary power consumption. Under theseconditions, the data compression module 136 seeks to optimally compressthe data in a lossless manner, when appropriate and in some casespermits a lossy data compression.

FIG. 2 is a block diagram illustrating data compression module 136. Theconcepts presented here will be described in general and at a relativelyhigh level as an overview, with a more detailed explanation of certainconcepts to follow with reference to subsequent figures. An analogsignal 200, such as a cardiac waveform, is obtained and converted intodigitized data 210 by the ADC 205 (or ADC 32 of FIG. 1). As is wellknown, the analog signal is sampled at some predetermined samplingfrequency (e.g., 1 MHz) and the value of the waveform is recorded foreach sampled point in time. In this example, the value will be a voltageon the order of milivolts. The resolution is defined between rails(upper and lower limits) by the total available increments (typicallyequal). For example, with 256 discrete increments the above examplewould be a sample frequency of 1 MHz with 8 bit resolution. 12 bitresolution would provide 4096 increments and so on.

The sampled digital waveform data 210 passes through a linear predictiveencoder 215 which acts to simplify the waveform for subsequentprocessing. This process will be described in greater detail but inshort, in one embodiment the derivative of the sampled waveform isobtained. More specifically, the first data point and certain subsequentdata points are left intact while the remaining sampled data points areconverted into the difference between a given data point and theprevious data point. Thus, the first data point remains the sampledvalue. The second data point becomes the difference between the secondsampled value and the first sampled value. The third data point becomesthe difference between the third sampled value and the second sampledvalue. To decode this data, the reverse process is performed. Again, thefirst data point is intact. The second data point is obtained by addingthe difference stored in memory to the first data point and so on.

The linear predictive encoder 215 encodes the data into a form thatgenerates a probability distribution that is generally centered about azero baseline and has approximately the same shape (despite generalvariations in original waveforms of the same type) for the highestprobability data points. This allows for the subsequent partialapplication of Huffman encoding which maps certain potential incrementsor values to a “codeword.” By using relatively short codewords for themost frequently used increments (those having the highest probability ofuse) a first order of data compression is achieved. For example, acodeword representing an 8 bit value might only have 2 bits; thus acompression ratio of 4:1 is achieved. To provide a complete Huffmanencoded alphabet for all potential values, some data points will map tosignificantly longer codewords. With an 8 bit example, one codeword willhave 256 bits. Therefore, to achieve an overall compression ratio thatis positive, the probability that given data points are obtained is anelement that should be known and controlled for; hence an understandingand calculation of entropy. The mapping of codewords to their values isstored in a lookup table in software, hardware or firmware and isavailable for both encoding and decoding. In FIG. 2 for example, thelookup table could be contained within the linear predictive encoder 215or stored within memory 124 and accessible by the linear predictiveencoder 215. A single lookup table provides the simplest scheme;however, it should be appreciated, that multiple lookup tables may beprovided and the appropriate table is selected based upon waveform type,point in time, or some other factor.

Once the derivative waveform data points are obtained, there is anoptimal band wherein the mapped codewords are equal to or shorter thanthe data they map to (e.g., 8 bits or less). Outside of this band, thecodewords are longer than the data they represent (e.g., 9 bits orlonger with our 8 bit example).

To summarize, in an 8 bit resolution example, each data point sampledwill be 8 bits long; in order to achieve data compression, codewordshaving less than 8 bits must be used for at least some data points. Ifshorter codewords were always used then every data point would achievecompression; however, in order to provide codewords for all potentialdata points, some of these codewords become very long. By selecting thecodewords so that the most likely data points have the shortestcodewords and the longer codewords are assigned to unlikely data points,the overall data scheme achieves compression, when properly mapped withprobability. Further analyzing the derivative data, it is possible todetermine which data points/codewords are equal to or less than thecurrent bit rate (e.g., 8 bits or less).

The data parsed by the linear predictive encoder 215 is subjected to arule processor 220 that evaluates whether, at a high level, the currentdata point is inside or outside of this optimized band. If the data iswithin the optimized band, then the codewords are substituted for thedata by the truncated entropy encoder 225 and stored in memory 230(which may or may not be the same as memory 124 of FIG. 1). If the datais outside of the band then the codewords are not used; rather, the raw(e.g. 8 bit data) is stored directly in the memory 230. While nocompression is achieved for these data points, there is no extra memoryusage for what would have been a longer codeword. While achieving goodresults, actual implementation is somewhat more complex in that both theencoder and separately the decoder need to be able to distinguishbetween codewords and raw data.

As previously indicated, the process is well suited for IMDs 100 thatare attempting to minimize power consumption and data buffering. Thus,one mechanism employed by the rule processor 220 is to determine whetherthe previous data point should or should not have been encoded. In thisapproach, the first data point that occurs as a waveform transitionse.g., out of the optimum band, will be encoded even though according tothe above logic it should not have been. Thus, when evaluating the nextsubsequent data point, the rule processor considers whether the previousdata point should or should not have been encoded. If the determinationis that the previous data point should have been encoded, then thecurrent data point in encoded. Conversely, if the previous data pointshould not have been encoded, then the current data point is notencoded. As these form definitive rules, the same process can occurduring decoding of the data. In this manner, the vast majority of datapoints are compressed and the lower probability data values aremaintained in either their raw length or a modified encoded form whichis longer than the raw length, but significantly shorter than somepotential encoded values.

FIGS. 3-7 illustrate various sampled waveforms, derivatives of thosewaveforms and probability distributions for the waveform and derivativewaveforms. FIG. 3A is a sampled waveform of a cardiac EGM from a normalsinus rhythm. FIG. 3B is the derivative of the waveform of 3A, whereinthe first data point remains unchanged but each subsequent data pointbecomes the difference between the current data point value and theprevious data point value. As a simple numerical representation, thesample waveform data will have data points 1, 2, 3, 4, etc. (with eachhaving some measured value for voltage and designated 8 bit value forthat voltage). The derivative waveform will have data points 1, (2-1),(3-2), (4-3), etc.

This is referred to herein as linear predictive encoding. That is, amodel or an equation is established. For each data point the model willprovide an expected or predicted value. The actual data point iscompared with the predicted value and the difference or error is storedrather than the data point. If a predictive equation were perfect, thenthe error would be zero (0) for each data point. That is, given thevalue for the first data point, the model will accurately predict eachsubsequent data point precisely. As an example, if the waveform were apure sine wave, its derivative is a cosine; thus, given a starting pointor series of initial points each subsequent point is calculated withcertainty.

In the real-world cardiac samples, there is no such precise repetitivepattern or available equation to model to achieve certainty inprediction; however, the concept holds. The model used herein is thateach data point is equal to the previous data point. Thus, when comparedto the model, the difference between the predicted value (i.e., the lastdata point) and the sampled value is the error for the model and thisvalue is stored. It should be appreciated that while biologic waveformswhether cardiac, EEG, or otherwise are unlikely to be precise, pristinesine waves, various algebraic models may be provided that are morecomplex than the example above. Furthermore, these models may benon-linear and may consider any number of previous data points inpredicting the current value. The more accurate the predictive model,the smaller the error values and the more effective the encoding.

FIG. 3C is a probability distribution of the values of the sampledwaveform in FIG. 3A and illustrates why the predictive encoding isuseful. The X axis represents probability (number of occurrences) withhigher probabilities corresponding to larger X values. The Y axis is theincrement (bit value). As these examples utilize an 8 bit resolution,there are 256 increments or potential values. These correspond to avoltage value. A probability distribution such as that of FIG. 3C allowsfor Huffman encoding to achieve effective results. That is, in order tooptimize Huffman encoding, the actual probability distribution must beknown. As just indicated, FIG. 3C is in fact the actual probabilitydistribution of the waveform of FIG. 3A. Unfortunately, FIG. 4A is asampled waveform from a patient with congestive heart failure and FIG.4C is the corresponding probability distribution. FIG. 5A is a sampledwaveform taken during ventricular fibrillation and FIG. 5C is thecorresponding probability distribution. FIG. 6A is a sampled waveformtaken during ventricular tachycardia and FIG. 6C is the correspondingprobability distribution.

In comparing the illustrated probability distribution graphs (FIGS. 3C,4C, 5C, 6C) it becomes apparent that they are quite distinct. The peaksare each centered about a different value; their shapes are differentand the values assigned are very different. This is readily apparent fordistinct types of cardiac waveforms; however even if other samples ofsimilar waveforms (e.g., normal sinus rhythm) were compared there wouldbe substantial variation within a given patient and more so betweenvarious patients in the population. As effective Huffman encodingrequires that the probability distribution be known (so that codewordscan be assigned) a priori and stored in memory as a lookup table, thevariance in waveform probability distributions illustrates a challenge.

FIGS. 7A-7D are probability distribution graphs of the derivativewaveforms (FIG. 3B, 4B, 5B, 6B). While not identical, they aresubstantially more similar than the previous probability distributions.Further, each probability distribution is uniformly centered about zero(0) and the most probable values fall within a relatively narrow band ofvalues. This would still not provide for an optimum Huffman alphabet forall potential values for all waveforms.

FIG. 8 is a graphical representation of a truncated encoding treeaccording to one embodiment consistent with the teachings of the presentinvention. The star illustrates the starting point or starting node.Each oval represents the decimal equivalent of the indicated 8 bit (forthis example) value and includes the set {0, −1, 1, −2, 2, −3, 3, −4, 4,−5, 5, −6, 6, −7, 7, −8, 8). Each square node is a junction and eachline indicates a bit value (0,1) depending upon direction. In thisexample, a line moving towards the left indicates a “0” and a linemoving towards the right indicates a “1” with movement recognized from ahigher position to a lower position, as illustrated. This convention isarbitrary and the reverse could be used instead (left is “1”; right is“0”).

This truncated coding tree provides the “codeword” for a given value.Thus, if the value to be encoded equals “−3” the codeword would be“00001”. Starting from the star, there are 4 leftward lines and onerightward line until the oval with “−3” is reached. Thus, for aparticular data point of the derivative waveform, the value may be “−3”and “00001” is encoded into memory. This is a 5 bit data point asopposed to an 8 bit data point as would normally be used. That is,assuming 0 is set to “128” on a 256 bit scale, then “−3” would normallybe the binary value for “125” or “01111101”. As the derivative waveformrepresents changes from one data point to the next, the values willusually be relatively small. The encoded value for “0” is “11”; theencoded value for “1” is “101” and so on. As these are the most probablevalues they have the shortest codewords and achieve the greatestcompression ratios.

As identified with reference to FIGS. 7A-7D, the most probable values(those further to the right on the X axis) fall within a relativelynarrow band. This is generally captured by using values from −8 to 8;which corresponds to our 8 bit example. Thus, in a 12 bit example, thetree would encode values from −12 to 12. Therefore, the most probableand most frequently used values will have a codeword assigned. It shouldbe appreciated that the values populating the tree are taken from thesample probability distribution. While taking the derivative waveformcenters the probability distribution about zero, the values used arelikely to be commonly employed. Of course, there may be variousembodiments wherein the most probably values differ from thoseillustrated and the tree will be populated with those values instead.

Another aspect of the codewords defined by the tree is that they areprefix free. That is, for this example, the 18 assigned codewords areunique and unambiguous. The codewords will vary from 2 bits to 8 bitsand it would not be possible to decode a value from a variable lengthcodeword in a stream of data absent this aspect. For example, accordingto FIG. 8, if a codeword begins with “1” it can only represent {0, −1,or 1}. “11” can only represent “0”; “101” represents “1”; and “100”represents “−1”. As such, “10011” could not be a single codeword becauseit would be ambiguous whether that data set indicated the singlecodeword or represented “−1” followed by “0”. When decoding the data, itis parsed until an unambiguous codeword is identified and the next bitbegins the next codeword.

As illustrated, codewords are provided for the decimal values of −8 to8. In a 256 bit example, the maximum difference between two adjacentdata points could in fact equal 256 ((128−(−128)=256). As a practicalmatter, the waveform is unlikely to swing that dramatically from pointto point. Nevertheless, point to point variations will likely exceed 8at times. The tree could be extended to provide codewords for all 256values; however, in order to be unambiguous these codewords would becomeincreasingly large with the largest having 256 bits. Hence, the presentembodiment utilizes a truncated entropy encoder. That is, for any valuenot displayed on the tree, the actual 8 bit value is utilized with aprefix or exit code which is the codeword indicated by the “X” oval onthe tree. This means that these data points will be encoded as 12 bitvalues. During decoding, the codeword for “X” is recognized and thedecoder then takes the next 8 bits for the data value. The data isparsed as discussed above beginning with the 9^(th) bit. This means thatthe system has utilized 12 bits to store an 8 bit value which isnegative compression factor. On the other hand, 12 bits is the maximumlength for any value and is significantly less than many of thecodewords that would exist for a fully expanded tree. This combined withthe lower probability of using values needing a codeword prefix resultsin an overall positive data compression.

To summarize, the truncated entropy encoder illustrated by FIG. 8indicates that codewords are provided for less than the complete set ofpotential data increments; thus the tree or data map is truncated. Thecodewords themselves are unambiguous, prefix free and one codeword isutilized to signal that a predetermined number of bits to follow areunencoded. In the illustration of FIG. 8, this is represented by thepopulated 4 bit “X” value and the 8 bit place holder. This X node orvalue will be referred to as the prefix codeword. It should beappreciated that in other protocols, different values may be encodeddepending upon probability and the X node may be provided at a differentnode either increasing or decreasing the required number of bits for theprefix codeword. Furthermore, systems using different resolution (e.g.,12 bit encoding) may be used with or without a corresponding expansionof the tree. It should also be appreciated that various combinations,while not illustrated, may be employed. For example, other uniquecodewords could be created that indicate longer or shorter data tofollow; or that other action is to be taken, such as error checking orthe like.

FIG. 9 is a waveform sample from a patient during ventriculartachycardia. FIG. 10 is a small portion (a QRS complex) of thederivative of the waveform of FIG. 9 and illustrates (as diamonds) thevarious points that are digitally sampled. This example continues to usethe 8 bit resolution and truncated tree illustrated in FIG. 8; thoughthis is non-limiting. For illustrative purposes, a high probability band300 is bounded by an upper limit 310 and a lower limit 320 and iscentered about zero. The high probability band 300 simply visuallyindicates that any data point falling on or in that band will have acodeword for its value; thus, in this case the upper limit 310 is equalto 8, while the lower limit 320 is equal to −8.

A few of the enumerated data points will be explained to describe theprocess. Initially, numerous samples are collected that fall within theband 300 prior to data point 1. As previously discussed, the first datapoint stored is stored unencoded and has the value from the actualwaveform, not the derivative. To avoid perpetuating any errors, thisprocess is repeated periodically. For example, after every 200 samplesthe process may be repeated so that another unencoded waveform datapoint is stored. The frequency of this error prevention can be selectedas desired and may be based on a number samples, periods of time,distinct events, other error checking parameters or any other conventionthat may be employed by both the encoder and the decoder. As data isdecoded sequentially, an error in a bit will propagate through andcorrupt the remaining data in the set. Periodically sending an unencodeddata point will restart the process and prevent this propagation.

With the present example in FIG. 10, data point 1 will be presumed to bean encoded data point. For data point 2, the rule processor 220evaluates data point 1 to determine whether data point 1 should havebeen encoded. Data point 1 was within the band 300 and should have beenencoded. Thus, data point 2 is encoded by the encoder 225. Data point 2appears to have the value of negative 8, thus the codeword would be“00000110”, which is stored in memory 230. For data point 3, the ruleprocessor 220 evaluates whether data point 2 should have been encoded.As data point 2 fell on or in the band 300, data point 2 should havebeen encoded. Thus, data point 3 is encoded even though it is outside ofthe band 300. To encode data point 3, which has a value of about −24,the prefix codeword is employed (“X+8 bit value for −24 (or 104)) whichin this example is “00011101000.” This value is stored in memory 230 bythe entropy encoder 225. For data point 4, the rule processor 220evaluates whether data point 3 should have been encoded. Data point 3was encoded, but should not have been in that in fell outside the band300. Thus, data point 4 is not encoded. Here the rule processor 220stores the 8 bit value of data point 4 directly in memory 230, bypassingthe entropy encoder 225 (of FIG. 2). When acting upon data point 7, therule processor 220 determines whether data point 6 should have beenencoded and it should not have been (and was not); thus, data point 7 isnot encoded despite falling within the band 300. Data point 8 will beencoded because data point 7 should have been; thus, data point 8 willhave a 12 bit value. Similarly, data point 14 will not be encodedbecause data point 13 should not have been. Here, there is no net lossas the codeword would have an 8 bit value; thus, using the actual 8 bitvalue is equivalent.

This process is referred to herein as linear predictive entropy encoding(LPEE); that is, determining whether to use entropy encoding based uponthe results of the previous data point. There is only a loss ofcompression (no loss of accuracy or resolution) when a 12 bit value isused where an 8 bit value or smaller could have been used or anunencoded 8 bit value is used where a codeword of less than 8 bits couldhave been utilized.

The following table is presented for each of the enumerated data points,which is a sample set selected arbitrarily for illustrative purposesonly.

Should Result Current Last Data last be Encode w/out Data Point Pointencoded? Current? Good/Bad? (LPEE)* 1 — y y good g 2 1 y y good g 3 2 yy bad b 4 3 n n good b 5 4 n n good b 6 5 n n good b 7 6 n n bad g 8 7 yy bad b 9 8 n n good b 10 9 n n good b 11 10 n n good b 12 11 n n good b13 12 n n good b 14 13 n n bad g 15 14 y y bad b 16 15 n n good b 17 16n n good b 18 17 n n good b 19 18 n n good b 20 19 n n bad g 21 20 y ygood g Ratio of bad or b to total 6/21 15/21 Good = coded for values inband or 8 bit data for values out of band Bad = 12 bit values (Prefixcodeword + 8 bit data) g = 8 bit or less b = 12 bit *results if all datapoints used codewords, including X prefix so maximum is 12 bit incurrent example The terms “good or bad” are not meant to indicate apositive or negative attribute, but only whether the optimum bit size isutilized

In this example, approximately 76 data points are illustrated with only15 falling outside of the band 300. Thus, over 80% of the data pointsfall within the band 300. While only illustrative and non-limiting (infact an arbitrarily selected waveform sample and length), the use oflinear predictive entropy encoding on this sample reduced the use of 12bit words by approximately 43%.

As previously indicated, there is substantial variation that occurs inencoding, compressing and storing data from various waveforms. Thewaveforms themselves may be quite distinct from one another to beginwith and the codewords employed vary in length and their use is basedupon probability. As an example, with the previously described exemplarywaveforms, sampled at 251 Hz with 8 bit resolution, the above describedtruncated entropy encoding embodiment provides for an average codewordlength of 3.4 for the normal sinus rhythm, 4.4 for atrial fibrillation,3.9 for congestive heart failure and 3.4 for ventricular tachycardia.The shortest codeword will be 2 bits and the longest will be 12 bits.These are presented for illustrative purposes and not meant to belimiting. When the rule based processor is added, the average valueswill decrease as many of the previous 12 bit codewords will be replacedby 8 bit values.

Thus far, there has been an assumption that the waveform spanned theentire dynamic range of the sampler. When this is not the case, theperformance of the encoding will improve even more. That is, higher,absolute value differentials will occur less frequently. With waveformsthat span about 50% of the range of the sense amplifier, the losslesscompression rates may be 4:1.

The embodiments described may be effectively utilized on streamed orreal-time data to achieve good data compression ratios while providinglossless data storage. Cardiac EGM data is effectively and efficientlystored in a reliable, real-time manner that allows for high resolutionreconstruction of the sampled waveform. Other physiological signals arealso well suited for this type of encoding. For example, cardiacpressure data is typically cyclic and falls within a narrow dynamicrange. Significant variation occurs when the patient changesenvironments (e.g., moves to a high altitude) and these infrequentvariations are effectively managed by using the predictive linearencoding. Thereafter, the truncated entropy encoding may be used toachieve high compression ratios. It should be appreciated that anyphysiologic waveform or any waveform in general may be stored using theembodiments described herein.

In some embodiments, the truncated encoding tree (FIG. 8) is defined andstored in memory in both the encoder and the decoder. Similarly, therule or algorithm for the linear predictive encoding is defined andstored in memory. For example, the current data point is assumed to beequal to the previous data point; the actual difference between the two(i.e., the error) is the value stored in memory. While both the encoderand decoder need to have the same tree and rule(s); neither the tree northe rule(s) necessarily must remain static. That is, adaptive Huffmanencoding may be utilized to develop a patient specific tree based uponsampled data. Furthermore, this tree may be periodically changed basedupon sampled data; therefore, the tree is dynamically changed as theunderlying probability distribution changes. For example, a new orupdated tree may be generated after several thousand samples and passedto the decoder as appropriate. Similarly, the linear predictive encodingrule(s) cold likewise be generated on a patient specific basis orupdated dynamically. That is, as the sample data is collected andprocessed, a more accurate (i.e., smaller error values) rule (linear ornon-linear) is derived. The new rule is then used on data subsequentlycollected.

The dynamic creation and modification of the tree as well as thepredictive encoding rule(s) would be most applicable in embodimentswhere the underlying signal may vary from source to source (e.g.,patient to patient) but has some regularity or pattern within a givensource over a useful time period. As explained, cardiac signals evenwithin a single patient will likely have too much variability to benefitsignificantly from such dynamic modification, particularly on areal-time or streaming basis. However, in other contexts the dynamicmodification could be utilized to increase compression of the data.

Thus far, data that is stored in memory represents a sampled data point,an encoded data point, or an entropy encoded codeword for the same. Thatis, the stored value ultimately reflects a given sampled value of therelevant waveform. It should be appreciated that many other types ofdata may be stored by a device separate from the sampled waveform. Inaddition, various indicators or markers may be interleaved with theencoded data.

For example, in various cardiac devices manufactured by the assignee ofthe present application, MarkerChannel™ data is created and recorded bythe device as an annotation of the events occurring within the senseddata. The events may be routine, such as a sensed atrial depolarization(A sense/P wave); a sensed ventricular depolarization (V sense/R wave);paced atrial event (AP); or paced ventricular event (VP). In addition,longer cardiac events such as, for example, atrial fibrillation (AF),ventricular tachycardia (VT) or the like are detected by the devicethrough various algorithms. The initiation of theses events or at leastwhen they are initially detected may likewise be annotated. Theannotation of the data is performed by the microprocessor 120 (FIG. 1)based on the data collected, in analog form or at any stage of thedigital signal processing.

Each device will typically record multiple channels of data. There maybe an atrial channel sensing atrial events, one or two ventricularchannels directly sensing ventricular events; other vectors between agiven lead/electrode and an electrode positioned within the housing ofthe device (e.g., right ventricular ring electrode to housing); and anynumber of other sensed parameters such as pressure or impedance.Typically, the annotation data is stored within the recorded data streamfor each channel. If the annotation data is stored separately, it mustbe correlated in time to the sensed data which requires additionalmemory usage. In order to identify the annotation, an exit code isprovided. For example, with 8 bit resolution and 256 discrete intervalsvalue “256” may be designated as the exit code. Thus, a sampled valuethat would equate to the interval 256 is assigned to 255; in other wordsvalues sensed at, e.g., the voltage corresponding to interval 256 areessentially rounded to the voltage of interval 255. This simply frees upone value to be used as the exit code.

When the exit code is stored, this indicates that a predetermined amountof data following the code is the annotation data. This might simply bea single word mapped to a predefined annotation, such as a V sense, Asense, etc. In this manner, minimal memory is expended and theannotation is correlated in time with the event in the relevantwaveform.

FIG. 11 is a block diagram illustrating sequentially stored data pointsin memory. Initially, there are a series of data points encoded asvariable length codewords 350. Data point 355 is an “X” codewordfollowed by an, e.g., 8 bit data value. Next, there are a series ofnon-entropy encoded data points 360, followed by another series of datapoints encoded as codewords 365. This simply represents a sample of thelinear predictive encoding and entropy encoding as previously described.

The data point 370 is the X codeword, again signifying that the data toimmediately follow is not entropy encoded. Here, rather than providingan 8 bit sampled data point, the exit code is provided. This signifiesthat the next stored data point (or series of points) is an annotation,such as MarkerChannel™ data. The annotation data point 375 is providedand signifies a particular event has occurred, started, or stopped atthis point in time or may be used to indicate any information relevantin time as determined by the algorithms stored within the device. Usingan 8 bit example, with a single word defining an annotation there are256 possible annotations. Of course, by using more that one word, moreannotations are possible. In this manner, the prefix codeword from thetruncated entropy encoding tree (FIG. 8) is used in combination with anexit code to indicated interleaved annotations.

Continuing with the stored data, another series of codewords 380 isprovided. Another prefix codeword 385 is stored, followed by the exitcode indicating annotation data is to follow. In this example, theannotation 390 is a codeword selected from the truncated entropyencoding tree (FIG. 8). As the data recorded at this point is now knownto be an annotation, the particular values utilized to represent theannotation may be mapped accordingly. Thus, rather that using an 8 bitvalue a codeword may be mapped to a given annotation. This will allowshorter values to be stored as annotations, which may be beneficial whencertain annotations occur frequently. Using only the truncated entropyencoding tree will produce less possible annotations (e.g., 18), whichmay or may not be sufficient. The same process may be utilized with theannotations as with the remaining data points. That is, codewords may beutilized for frequent annotations and the combination of the prefixcodeword followed by a full-length word may be used for any otherannotation not defined by the truncated entropy encoding tree. In such asituation, the prefix codeword (X), would be followed by the annotationexit code. The next data point would either be just a codeword (asillustrated) or another entry of the prefix codeword followed by theannotation data. This would represent a longer value (e.g., 12 bits inthe 8 bit resolution example), but would be offset by the repetitive useof short codewords at other times.

As indicated, the relevant device, such as IMD 100 not onlycollects/samples the waveforms and records some or all of this data intomemory, it also analyzes the data to identify events. This may occurwhether or not the data is annotated. Returning to FIG. 10, anotherembodiment of the present invention will be described. What isillustrated is a derivative of a sample QRS complex recorded from asingle channel. As previously indicated, this is an arbitrary selection,centered on the QRS with a portion of the PQ segment and a portion ofthe ST segment illustrated. In processing such a waveform, the IMD 100may identify the peak of the R wave (point 10, 11) as a means ofdetecting a ventricular event. Once so identified, other aspects of thecomplex may be measured, such as the QRS width. Alternatively, theinitial deflection may be detected (e.g., points 3, 4) to initiallyidentify the ventricular event. Regardless of the specific mechanism,the complex is detected and if appropriated, annotated.

Of the arbitrary sample selected, the majority of the data points fallwithin the optimum band (310, 320) and are generally stored with acodeword. The QRS complex itself spans beyond the optimum band (310,320) but is the most clinically interesting feature. In one embodiment,consistent with the teachings of the present invention, the entropyencoding compression is disabled upon the detection of one or moreevents, such as an atrial sense, atrial pace, ventricular sense,ventricular pace, or the onset of particular rhythms such as ventricularfibrillation or tachycardia. Whatever the process the IMD 100 identifiessuch events will be utilized to disable the entropy encodingcompression. The compression will be disabled for a predetermined periodof time relevant to the event, such as an averaged measured QRS durationfor a given patient or an average value for a patient population.Alternatively, compression may be disabled for a predetermined number ofsamples or until the event concludes, as actually sensed by the device.

In this manner, the data points compressed generally all fall within theoptimum band. The data points occurring during the events are notcompressed, but there is also no need to use the prefix codeword, thusavoiding combinations that exceed the normal resolution value (e.g.,avoid 12 bit word length for 8 bit data point). Depending upon thenature of the signals processed, disabling compression when an event isdetected may or may not result in a better overall compression and useof such a feature is selected accordingly. It should be appreciated thatwith multi-channel recording, a given event such as an atrial sensemight only be sensed on one channel (e.g., the atrial lead). Thus, theother channels would continue to be compressed when this is the case,with only the relevant channel(s) disabling compression.

FIG. 12 is a flowchart describing one method consistent with theteachings of the present invention. The relevant device, such as an IMD100 obtains an analog input representing a physiologic waveform. Thedevice samples 400 this signal to obtain a digital representation of thewaveform according to the parameters of the ADC being utilized. Thedigitized data is then subjected to linear predictive encoding 405. Itshould be appreciated that this may be occurring on a real time (datapoint by data point) basis or by buffering a certain amount of data. Thelinear predictive encoding 405 generates 410 a derivative of the sampledwave form. Thus, the first data point is left unchanged. Subsequent datapoints are replaced with a value equal to the difference between thatdata point and the value of the previous data point. At predeterminedintervals, another data point is left intact to prevent the propagationof errors.

Thus, at this point a data point will be a value representing thesampled digital value of an analog waveform at a specific point in timeor a derivative value of a particular sampled point. The data point isnext subjected to a rule process 415 which evaluates whether theprevious data point should or should not have been entropy encoded 420.If not, then the current data point is stored 425 in memory in anunencoded, uncompressed form (e.g., an 8 bit value as in the aboveexample). Alternatively, if the previous data point should have beenentropy encoded, then a codeword is substituted 430 for the value of thecurrent data point. The determination of whether a given data pointshould or should not have been entropy encoded is based upon whether theprevious value fell on or within an optimum band defined by a truncatedentropy encoding map.

When a code word is to be substituted 430, the value of the data point(e.g., the “error”) is compared with the truncated entropy map and adetermination is made 435 as to whether a specific codeword is definedfor this value. If so, then that code word is substituted 440 for thatvalue and the code word is stored in memory. If not, then the prefixcode word is utilized and the actual data point value (e.g., 8 bit valueof difference between current sampled data point and value ofimmediately preceding data point) is added to or stored after the prefixcodeword. Thus, the prefix code word and data point are stored 445 inmemory.

To decode, the reverse process is performed. That is data is extractedfrom a device and decoded. The first value is known to be an unencodedstarting value. The device then takes the next data point value and addsit to the first data point value to determine that actual waveform datapoint. For the third data point, the device determines whether thesecond data point (e.g., an error value) should have been encoded (basedon its value). If so, then the third data point is a codeword and thecodeword is decoded into an error value and the error value is added tothe reconstructed second data point to obtain the third data point. Ifthe second data point should not have been encoded, then the third datapoint is an actual value (e.g., 8 bit) and not a codeword. The processcontinues until the next unencoded data point wherein the processrestarts. In this manner, data compression is achieved and the originalwaveform may be extracted without loss.

FIG. 13 is a block diagram illustrating a decoding system. A receiver500 is provided to receive the stored waveform data. This will typicallyinvolved receiving telemetered data from an implantable device eitherdirectly or via one or more intermediary devices. The receiver 500 maystore data in a local memory 520 for subsequent processing or may sendthe data directly to a decoder 505 which parses the data. The initialdata point and the appropriate subsequent data points are unencoded,non-derivative data of the original sampled waveform and these valuesare provided by a data output module 535 accordingly. A first wordextractors 525 represent the module that identifies the first andsubsequent unencoded, non-derivative data. The output from the dataoutput module 535 may be directed to the memory 520 and/or anotherdevice for display, analysis or processing.

For the remaining data points, the decoder 505 engages an entropy ruledecoder. The entropy rule decoder 510 evaluates the value of a datapoint (a derivative point therefore representing a difference in valuebetween adjacent data points) immediately prior to the data pointcurrently being evaluated. If this value is such that is should havebeen entropy encoded, then the entropy rule decoder 510 determines thatcurrent data point is an entropy encoded codeword. The codeword isparsed by a codeword mapping module 530 that provides the value from alookup table for the codeword. This will either provide a value orindicate that the value is contained within the following predeterminednumber of bits (e.g., a prefix codeword). Either way, a value of thederivative for the current data point is obtained and passed to the dataextractor 515.

Conversely, the entropy rule encoder may determine that the previousdata point should not have been entropy encoded. Thus, the current datapoint is not entropy encoded. As such, the value of this derivative datapoint is an unencoded (i.e., not entropy encoded) value of apredetermined length (e.g., 8 bits). This value is passed to the dataextractor 515 accordingly.

The data extractor 515 functions in an opposite manner to the linearpredictive encoder. That is, the data extractor 515 receives values foreach data point representing its derivative. Thus, to reconstruct thewaveform, the derivative value is added to the value of the previousdata point to become the actual value for the current data point. Thesampled waveform data is thereby reconstructed without loss and providedthrough data output 535 to memory 520, a display, or another device formanipulation, use or analysis.

FIG. 14 is another example of a truncated entropy encoding tree. Aspreviously addressed, the tree is a graphical representation ofunambiguous codewords assigned to the highest probability values for arelevant waveform type. In the earlier example, unitary increments wereassigned codewords from a value of −8 to 8, inclusive of 0 and alsoinclude the prefix codeword X. FIG. 14 illustrates that the code wordsare not limited to unitary values, but may in fact represent a string orsequence of 2 or more values. The most liking occurring unitary valuesor sequences are given the shortest codewords. Accordingly, the sequenceof a “1” followed by another “1” is as probable as a single occurrenceof a “1” and is more probable than a “4”. In other words, ifidentifiable sequences have a high probability they may assignedcodewords; which, with a limited set of available codewords willdisplace some other value.

The tree may be based upon generalized data. For example, over a widepatient population the sequence “1,0,1” might be quite common and henceincorporated into the tree stored in the memory of the encoder anddecoder. Alternatively, the tree may be built upon collected data from agiven source, such as a patient, shortly after implant. Finally, asnoted above, the tree may be periodically updated through adaptiveencoding. Thus, as data is actually collected and processed, repetitivesequences are detected and encoded. If, over time, this sequenceschanges, then the tree will continue to be updated as well.

The use of a codeword to represent a repetitive sequence of values willgenerally increase the compression ratio. A single 3 bit codeword ismore efficient than four 3 bit codewords. However, not every repetitivesequence is efficiently replaced by a codeword. The efficiency gained bydevoting a codeword to a sequence should be compared to the efficiencylost by either moving a unitary valued to a longer codeword (by eitherexpanding the overall size of the tree or displacing another value) orremoving that value from the tree entirely. As an example, if thesequence “0,0” occurred far more frequently than a single “0”, then itmay be more efficient to have the codeword for “0,0” equal to the binaryvalue 11 and shift “0” to a longer codeword. Conversely, even if “0,0”occurs often but less than a single “0”, then such a change would beless efficient. Also, if such a change were made, other values may shiftas well. For example, a “1” may be moved to the illustrated value for“4” (assuming “1,0,1”, “2”, “1,2,1,” and “X” would remain unchanged) onthe tree; thus changing from a 3 bit value to a 5 bit value. Again, itwould only be efficient to add the short codeword for “0,0” if thefrequency of the “1” with a longer bit codeword permitted an overallincrease in compression.

In summary, codewords may be utilized for unitary values or forsequences of two or more values that occur with sufficient frequency.While FIGS. 8 and 14 provide a means to illustrate the assigned values,it should be appreciated that the overall assignment of values occursdue to a probability distribution. The particular sequences consideredwill be evaluated in the same manner in such a probability distributionand assigned codewords accordingly.

The compression of sampled data with the present embodiments islossless. That is, the reconstructed waveform will be identical to thesampled waveform after decoding. Often, the analysis of the collectedwaveforms requires a high degree of accuracy and lossy data compression(or loss due to other factors) could prevent accurate interpretation andthe detection of significant events. On the other hand, noise and otherextraneous variations in the collected waveform are also sampled andlosslessly compressed.

The IMD 100 is provided, in some embodiments, with a smoothing module160 (FIG. 1) to smooth or filter the data either prior to sampling orpost-sampling. To the extent the particular application does not requireprecise waveform processing then known, generalized filtering techniquesmay be utilized. For example, a low pass filter may be provided tofilter the analog data prior to sampling.

FIG. 15 is a graph illustrating an exemplary waveform 600 with thelinear analog signal in solid line and a plurality of sampled valuesindicated by diamonds. The X axis defines time (0.3 seconds) and the Yaxis defines the signal value in milivolts or rather, the sample valuesassigned to the same.

The clinically significant portion of the illustrated waveform 600 isthe QRS complex 610 that occurs approximately between data point 612 anddata point 614. The overall width, shape, and amplitude of the QRScomplex 610 may be important and if so, it would be undesirable tosubject this portion of the waveform to a filtering function, such as alow pass filter. The data between data point 614 and the lastillustrated data point 616 is relatively flat and the previouslydescribed encoding process would become even more effective if thisportion of the data were smoothed. That is, the minor deflections notedare likely noise. The data points (614 to 616) could be replaced byzeroes. When parsed by the linear encoder, the value between the datapoints would be zero, which has the shortest available codeword.Further, if available, codewords for strings of zeros would also beavailable to increase compression. While there is a loss of some data,it is not significant to an analysis of the waveform 600.

While conceptually feasible, the selective application of filteringfunctions to portions of a waveform is challenging. That is, the IMD 100would have to buffer data, analyze the waveforms, and selectively applydifferent filtering functions to different portions of the data. This isoften not possible or practical with the time, memory and/or processinglimitations of various implantable medical devices.

Thus, one embodiment consistent with the teachings of the presentinvention provides a digital smoothing function that will smoothrelatively stable portions of a waveform but leave more dynamic portionsgenerally unchanged. The smoothing function permits near real time dataprocessing with minimal buffering requirements. The smoothing module 160analyzes each data point and determines variability between that datapoint and those adjacent to it to determine a variance. If the varianceexceeds a predetermined value, then the data point value utilized is setequal to the sampled data point. If the variance is below thepredetermined value, then a formula is applied to adjust the value ofthe data point. For example, an average or a weighted average isobtained between the data point and those immediately adjacent to it andthe average (or weighted average) value is then utilized as the sampledvalue. This will smooth functions where there is relatively minorvariation from point to point; however, where larger changes arepresent, the smoothing function has no effect.

FIG. 16 is a flowchart describing the smoothing algorithm. Initially,the IMD 100 enables (700) the smoothing function. Three sampled datapoints (N−1, N, N+1) are collected and compared (705). This set of datapoints is referred to as an adjustment set and will vary for each datapoint. More (or fewer) points could be utilized; however, the morepoints utilized the greater the impact of the smoothing function on moresignification portions of the waveform. The comparison (705) of thethree data points is performed to calculate (710) a value forvariability between them. For example, variability (V) may be calculatedby:V=|(N)−(N−1)|+|(N+1)−(N)|

The variability value (V) is then compared (715) to a predeterminedmaximum value (MAX). In one embodiment, MAX is equal to 5, but may beset to any value appropriate for the particular context. Thus, if anysingle point to point variation is equal to or greater than MAX or theabsolute value of consecutive point to point variations sum to MAX orgreater (e.g., 5), variability is deemed too high to apply the smoothingfunction to the current data point (N). As such, the sampled value for Nis stored (720) in memory for data point S_(N). During subsequentencoding (730), the value S_(N) is used. The process then repeats forthe next subsequent data point (e.g., N+1 is compared with N and (N+2)).

Assuming V<MAX, then the value S_(n) is adjusted (725) and then stored.In one embodiment, S_(n) is averaged over the adjustment set. Forexample,S _(n)=(N+(N−1)+(N+1))/3

In an alternative embodiment, S_(n) is set to a weighted average. Insome embodiments, the weighted average is raised (ceil (C++functionality)) or lowered (floor (C++ functionality)) to the nextinteger value. For example,S _(n)=floor(¼(N−1)+½(N)+¼(N+1)); orS _(n)=ceil(¼(N−1)+½(N)+¼(N+1))

Regardless of whether one of these functions is specifically employed,the value is rounded to an integer value representative of the digitalsampling interval. The value calculated is then stored in memory (orbuffered) for the data point S_(N). The process is repeated for the nextdata point N+1. In this manner, relatively stable portions of thewaveform are smoothed while more dynamic portions are not; but thisoccurs on a point to point analysis so that the smoothing functionitself is dynamically responsive.

The smoothing function is applied to the sampled data prior to using thelinear predictive encoding. This leads to a smoother waveform from whichthe predictive values are encoded and hence, a shift too shortercodewords when entropy coding is applied. It should be appreciated thatthe smoothing function could be applied after the predictive encodingprocess. In addition, the signal could be smoothed both before and afterthe encoding process.

As previously presented, certain events may be used to initiate a periodof time where entropy encoding is not utilized. For example, entropyencoding is disabled for a typical QRS duration upon sensing aventricular depolarization. It should be appreciated that disablingentropy encoding may be utilized in combination with the smoothingfunction. In one embodiment, entropy encoding would be disabled for anydata that does not pass through the smoothing filter. Alternatively,some predetermined number of higher variability data points must occurconsecutively prior to disabling the entropy encoder either for thosedata points not parsed by the smoothing function or for a predeterminedperiod of time.

While multiple embodiments have been disclosed, still other embodimentsof the present invention will be apparent to those skilled in the artwhile remaining within the spirit and scope of the present invention.Accordingly, the drawings and detailed description are to be regarded asillustrative in nature and not restrictive. Numerous embodiments andexamples have been described herein alone and in various combinations.It is contemplated that any and all of various embodiments and exampledmay be combined in whole or in part whether or not specificallydescribed herein and any such combination is considered within thespirit and scoped of the disclosure.

1. An implantable medical device (IMD) comprising: a memory; an analogto digital converter (ADC) configured to receive an analog waveform andsample the waveform into digitized data; a smoothing filter configuredto process the sampled signal and classify each data point into a firsttype or a second type and to apply a smoothing function to the firsttype of classified data and to retain a sampled valued for the secondtype of classified data; a predictive encoding module operativelycoupled with the ADC to generate an encoded waveform data point for eachof an equivalent data point from a subset of the digitized data; and anentropy encoding module operatively coupled with the predictive encoderand configured to selectively replace an encoded waveform data pointwith a codeword for that data point; and wherein the smoothing filter isconfigured to determine variability between sampled data points adjacentto a given data point being classified and classifying the given datapoint into the first type if the variability is less than apredetermined variability value and into the second group if thevariability is equal to or greater than the predetermined variabilityvalue.
 2. A method comprising: obtaining sampled data; defining anadjustment set of data points for each given data point; determining avalue for variability in the adjustment set; and smoothing the givendata point relative to the adjustment set responsive to the determinedvariability being below a predetermined maximum; wherein the adjustmentset includes the given data point, a first data point immediatelypreceding the given data point and a second data point immediatelysubsequent to the given data point; wherein determining variabilityincludes measuring a difference in a value between each data pointwithin the adjustment set; and wherein determining variability includesadding a first absolute value of a difference between the first datapoint and the given data point and a second absolute value of adifference between the second data point and the given data point.
 3. Amethod comprising: obtaining sampled data; defining an adjustment set ofdata points for each given data point; determining a value forvariability in the adjustment set; and smoothing the given data pointrelative to the adjustment set if the determined variability is below apredetermined maximum, wherein smoothing the given data point includesaveraging the adjustment set and setting a value of the given data pointfor subsequent encoding equal to the average value; and furthercomprising predicatively encoding the sampled data subsequent toselectively smoothing the data; and further comprising selectivelyproviding entropy encoded codewords for the predicatively encoded databased upon a truncated entropy codeword set.
 4. The method of claim 3,wherein entropy encoding is only provided for smoothed data points. 5.The method of claim 3, further comprising: analyzing the sampled datawherein the sampled data represents cardiac waveforms; identifyingcardiac events; and entropy encoding portions of the data absentidentified cardiac events.
 6. The method of claim 5, wherein thedetermination of variability is utilized in the identification ofcardiac events.